// BWSetting.h: interface for the CBWSetting class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BWSETTING_H__C8CEDEA1_F758_4EF7_8FCB_133B9C417AB3__INCLUDED_)
#define AFX_BWSETTING_H__C8CEDEA1_F758_4EF7_8FCB_133B9C417AB3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <afxtempl.h>

/*
[Common]
Project=Project Name
Items=Project Items Count
Comments=Project Comments
BaseDir=Project's host directory
PreCompile=before compile, launch this program(bat, cmd, exe...)
PostCompile=after compile, launch this program(bat, cmd, exe...)
*/

#include "CMarkup/Markup.h"
/*
<?xml version="1.0">
<common>
	<Project>Project Name</Project>
	<Comment>Project Comment</Comment>
	<BaseDir>Project's host directory</BaseDir>
</common>

<Item name="project 1">
	<select>yes</select>
	<Comments>blabla</Comments>
	<Command>msdev otp_tools_win/OTPProxyRes/OTP_ProxyRes.dsp /make "OTP_ProxyRes - Win32 Release" /REBUILD</Command>
</Item>

*/
typedef		struct _STU_BWS_COMM 
{
	char		szPrjName[MAX_PATH];
	char		szAuthor[MAX_PATH];
	int			nItems;
	char		szComments[MAX_PATH];
	char		szLogFile[MAX_PATH];

	char		szBaseDir[MAX_PATH];
	char		szPreCompile[MAX_PATH];
	char		szPostCompile[MAX_PATH];

	char		szIncDir[MAX_PATH * 8];			// 256 * 8
	char		szLibDir[MAX_PATH * 4];
	char		szExeDir[MAX_PATH * 4];

}STU_BWS_COMM, *PSTU_BWS_COMM;

typedef		struct _STU_BWS_ITEM 
{
	char		szComponent[MAX_PATH];
	char		szComments[MAX_PATH];
	char		szCmdl[2049];
	char		szStatus[10];					// Selected, no-selected.
}STU_BWS_ITEM, *PSTU_BWS_ITEM;


class CBWSetting  
{
public:
	BOOL InitSettings();
	BOOL InitXMLSettings();
	CBWSetting();
	CBWSetting(LPCSTR	strFname);
	virtual ~CBWSetting();

	CString m_strIni;				// Settings File.

public:
	void SetSettingFile(LPCTSTR lpstrFile);
	void GetAppDir(CString &strPath);
	void PatchVarString(CString &strDst, LPCTSTR strVar);
	void UpdateItemStatus(LPCTSTR strItem, LPCTSTR strStatus);
	void UpdateXmlItemStatus(UINT nItem, LPCTSTR strStatus);
	STU_BWS_COMM		m_stuBWS_COMM;
	CArray<STU_BWS_ITEM, STU_BWS_ITEM> m_arrBWItems;

};

#endif // !defined(AFX_BWSETTING_H__C8CEDEA1_F758_4EF7_8FCB_133B9C417AB3__INCLUDED_)
